\newpage
\section{WCF}
For our project we will use Windows Communication Foundation (WCF) to maintain the connection between server and clients. We will use address, binding, contract (ABC)\cite{WCF}.

Addresses is where we connect to. It can be a Host or IP of the computer, that the WCF Server is hosted at.

For bindings there is a wide range of options. There is HTTP-Bindings which uses Simple Object Access Protocol (SOAP) and sends data in form of Extensible Markup Language (XML). This is especially useful if we ever wanted to extend our support to other platforms as XML is readable for all major platforms, but it does contain loads of metadata that makes the objects larger and results in longer transfer time. To avoid long transfer time it is possible to use a netTCP binding but using this binding limits the support to only be within the dotnet platform as it sends the data in a binary format which only can be parsed within dotnet.

For our project we will use the standard basicHTTP binding as it is the easiest for testing and setting up. Everything can be setup in a config file, so it is easily changeable if administrators of the system would wish to provide other binding options later on. Possibly the best option, if this system was to be deployed, could be a wsHTTP binding as it provides flexibility and extended support to mobile platforms. Another function is that the wsHTTP binding as well as netTCP offers encrypting with secure socket layer(SSL), which provides a secure transport of the data from clients to server. Encrypting is especially important to keep the user's information safe from possible third party that could use the information in a harmful way. However, security is not our main focus in this project and therefore will be using the basicHTTP binding for simplicity.

\begin{figure}[H]
\centering
\includegraphics[width=0.3\linewidth]{img/WCFInterface.png}
\caption{Example of our Interface Contract used in our project}
\label{fig:WCFInterface}
\end{figure}

For the Contract, we will setup a Service Contract interface, containing the necessary Operation Contract, which is used by our clients to send data to the server. The server will process the request and then return the requested result to the clients which then will show the user what is available to them. In \figref{fig:WCFInterface} we see our service interface with the methods that will implemented.



We will also set up our WCF with multithreaded support, with each call being executed in it's own thread as it makes use of multiple cores in the machine and makes it possible to serve multiple clients requests simultaneously. This multithreading is handles by the WCF as long as it is set up with this service behavior.

\begin{lstlisting}
    [ServiceBehavior(
        InstanceContextMode = InstanceContextMode.PerCall,
        ConcurrencyMode = ConcurrencyMode.Multiple,
        UseSynchronizationContext = true)]
\end{lstlisting}